package com.proxy.jdk;

import com.proxy.ISubject;
import com.proxy.Subject;

import java.lang.reflect.Proxy;

/**
 * 每一行代码，都是改变世界的力量
 *
 * @author 郭帅
 * @date 2021/11/19 9:20 下午
 */
public class Main {

    public static void main(String[] args) {
        ISubject subject = new Subject();
        InvocationHandlerImpl handler = new InvocationHandlerImpl(subject);
        ISubject proxy = (ISubject) Proxy.newProxyInstance(subject.getClass().getClassLoader(), subject.getClass().getInterfaces(), handler);
        proxy.hello("123");

    }

}
